<html>
<head><meta charset="utf-8"><title>Do comments invalidate incremental compilation? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html">Do comments invalidate incremental compilation?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="220811931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220811931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> KalitaAlexey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220811931">(Dec 23 2020 at 17:59)</a>:</h4>
<p>I created a library lib2, a library lib1 and a binary bin1. bin1 depends on lib1. lib1 depends on lib2.<br>
I added an empty comment to lib2/lib.rs and executed cargo build in bin1, it recompiled lib2, lib1 and bin1. Does it consider lib2 to be changed? How can i debug it?</p>



<a name="220812650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220812650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220812650">(Dec 23 2020 at 18:07)</a>:</h4>
<p>As far as cargo knows it needs to be recompiled. Incremental compilation however will cause a lot of things to be saved between the last compilation of lib2, lib1 and bin1.</p>



<a name="220812743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220812743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220812743">(Dec 23 2020 at 18:08)</a>:</h4>
<p>Comments currently do invalidate more than necessary though as it changes the <code>Span</code> of things coming after it. <code>Span</code>'s are stored in many internal data structures, which would then become invalidated too.</p>



<a name="220812774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220812774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220812774">(Dec 23 2020 at 18:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/43088">#43088</a></p>



<a name="220813829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220813829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> KalitaAlexey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220813829">(Dec 23 2020 at 18:20)</a>:</h4>
<p>Can I use "-Z incremental-ignore-spans" to work around it?</p>



<a name="220813931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220813931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220813931">(Dec 23 2020 at 18:21)</a>:</h4>
<p>That will make compilation of the everything a bit faster, but everything will still need to be recompiled.</p>



<a name="220814083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220814083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220814083">(Dec 23 2020 at 18:23)</a>:</h4>
<p>Any change to a crate will result in a different SVH, which in turn will require everyone that depends on it to be recompiled. Otherwise you will get an error that the old version of the crate couldn't be found.</p>



<a name="220823404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220823404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220823404">(Dec 23 2020 at 20:14)</a>:</h4>
<p>See also <a href="https://github.com/rust-lang/rust/issues/47389">#47389</a>.</p>



<a name="220833222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220833222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pierwill <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220833222">(Dec 23 2020 at 22:32)</a>:</h4>
<p>(deleted)</p>



<a name="220854430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Do%20comments%20invalidate%20incremental%20compilation%3F/near/220854430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Do.20comments.20invalidate.20incremental.20compilation.3F.html#220854430">(Dec 24 2020 at 07:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="352416">KalitaAlexey</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Do.20comments.20invalidate.20incremental.20compilation.3F/near/220811931">said</a>:</p>
<blockquote>
<p>I created a library lib2, a library lib1 and a binary bin1. bin1 depends on lib1. lib1 depends on lib2.<br>
I added an empty comment to lib2/lib.rs and executed cargo build in bin1, it recompiled lib2, lib1 and bin1. Does it consider lib2 to be changed? How can i debug it?</p>
</blockquote>
<p>In general the debug information might need to change even if it's just a change to a comment.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>